<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8">
		<title></title>
		<style type="text/css">
			.red{
				color: red;
				text-decoration: underline;
			}
		</style>
	</head>
	<body>
		<div>
			<img src="img/off.png" width="200px" id="light">
			<h1 id="text">灯灭了！</h1>
		</div>
		<script src="js/jquery-3.7.0.min.js" type="text/javascript" charset="utf-8"></script>
		<script type="text/javascript">
			var huff=false;
			$("div").click(function(){
				var img=$("#light");
				var h1=$("#text");
				if(huff==false){
				 	 img.attr("src","img/on.png");
					 h1.html("灯亮了！");
				 	 //h1.attr("style","color: #FF0000;")
					 //h1.css("color","#FF0000");
					 h1.addClass("red");
				 	 huff=true;
				 }
				else{
					img.attr("src","img/off.png");
					h1.html("灯灭了！");
					//h1.attr("style","color:black;")
					h1.removeClass("red");
					huff=false;
				}
			})			
		</script>
	</body>
</html>
